#ifndef __THREADSTRUCTURE_H__
#define __THREADSTRUCTURE_H__

typedef struct priorite{
  int priorite_max;
  int priorite_actu;
} priorite;

typedef enum boolean{
  TRUE,
  FALSE
}boolean;

typedef enum status{
  STATUS_READY,
  STATUS_FINISH,
  STATUS_STOP
}status;

/*
 * La structure fifo des threads  
 */
typedef struct thread {
  int tid;
  priorite priority;
  boolean is_father;
  struct thread *father; 
  boolean est_attendu;
  boolean a_le_verou;
  int verou_id;
  ucontext_t *context;
  status state;
  void * valRetour;
  void ** adresseValRetour;
  struct thread *threadAttendant; 
} thread;

void setRunningThread(thread * th);

int estLeThreadCourant(int tid);

int getRunningThreadTid();

thread* getRunningThread();

ucontext_t* createContext(void(*func)(void),void *funcarg);

thread * newThread(int tid, enum status, ucontext_t * uc);

int getNextTID();

#endif/*THREADSTRUCTURE*/
